#include <stdio.h>
#include <stdlib.h>
void f(int a,int b,int c)
{
    if(a%4==0&&a%100!=0||a%400==0)
    {
        switch(b)
        {
            case 1:printf("%d",31+c);break;
            case 2:printf("%d",60+c);break;
            case 3:printf("%d",91+c);break;
            case 4:printf("%d",121+c);break;
            case 5:printf("%d",152+c);break;
            case 6:printf("%d",182+c);break;
            case 7:printf("%d",213+c);break;
            case 8:printf("%d",244+c);break;
            case 9:printf("%d",274+c);break;
            case 10:printf("%d",305+c);break;
            case 11:printf("%d",335+c);break;
            case 12:printf("%d",366+c);break;
        }
    }
    else
    {

        switch(b)
        {
            case 1:printf("%d",31+c);break;
            case 2:printf("%d",59+c);break;
            case 3:printf("%d",90+c);break;
            case 4:printf("%d",120+c);break;
            case 5:printf("%d",151+c);break;
            case 6:printf("%d",181+c);break;
            case 7:printf("%d",212+c);break;
            case 8:printf("%d",245+c);break;
            case 9:printf("%d",273+c);break;
            case 10:printf("%d",304+c);break;
            case 11:printf("%d",334+c);break;
            case 12:printf("%d",365+c);break;
        }
    }
}
int main()
{
    int a,b,c;
    scanf("%d-%d-%d",&a,&b,&c);
    f(a,b,c);
    return 0;
}
